package its.opt.operators;

import its.opt.graphs.FrequencyDecisionGraph;
import its.opt.graphs.LabeledTreeNode;

public class Operator implements Comparable<Operator> {
	public double gain;
	public OperatorType type;
	public int where;
	public int label;
	public FrequencyDecisionGraph decisionGraph;
	public LabeledTreeNode node;
	public LabeledTreeNode node2;

	public Operator() {

		reset();
	}

	public void reset() {

		gain = -1;
		type = OperatorType.OPERATOR_NONE;
		where = -1;
		label = -1;
		node = null;
		node2 = null;
	}

	/**
	 * Copies the values of the operator
	 * 
	 * @param operator
	 */
	public void updateTo(Operator operator) {

		this.gain = operator.gain;
		this.type = operator.type;
		this.where = operator.where;
		this.label = operator.label;
		this.decisionGraph = operator.decisionGraph;
		this.node = operator.node;
		this.node2 = operator.node2;

	}

	/** {@inheritDoc} */
	public int compareTo(Operator bestOperator) {
		if (this.gain > bestOperator.gain) {
			return 1;
		} else if (this.gain < bestOperator.gain) {
			return -1;
		} else {
			return 0;
		}
	}
}
